package TEST3;

import java.util.Scanner;

class Mouse implements Usb{
    public void turnon() {
        System.out.println("鼠标启动了");
    }
    public void turnoff() {
        System.out.println("鼠标关闭了");
    }
}
class Keyboard implements Usb{
    public void turnon() {
        System.out.println("键盘启动了");
    }
    public void turnoff() {
        System.out.println("键盘关闭了");
    }
}
class Mic implements Usb{
    public void turnon() {
        System.out.println("麦克风启动了");
    }
    public void turnoff() {
        System.out.println("麦克风关闭了");
    }
}
class Computer{
    Usb[] usb=new Usb[10];
    int num=0;
    int n;
    public void add(Usb u) {
        usb[++num]=u;
    }
    void poweron() {
        for(int i=1;i<=num;i++) {
            usb[i].turnon();
        }
        System.out.println("计算机启动成功");
    }
    void poweroff() {
        for(int i=1;i<=num;i++) {
            usb[i].turnoff();
        }
        System.out.println("计算机关机成功");
    }
}
public class Test {
    public static void main(String[] args) {
        Scanner in=new Scanner(System.in);
        Computer computer=new Computer();
        computer.add(new Mouse());
        computer.add(new Keyboard());
        computer.add(new Mic());
        computer.poweron();
        computer.poweroff();
        in.close();
    }
}

